import request from "@/utils/request";
import type { PartialSearchDTO, SearchGoodVO } from "@/types/searchType";
import type { Response } from "@/types/response";

enum ENUM {
   searchGoodsAPI = "/search/all",
   searchTipsAPI = "/search/tips",
}

/**
 * @description 商品搜索的接口
 * */
export const searchGoodsAPI = (data: PartialSearchDTO): Promise<Response<SearchGoodVO>> => request<SearchGoodVO>({
   url: ENUM.searchGoodsAPI,
   method: "POST",
   data,
});

/**
 * @description 搜索提示语的接口
 * */
export const searchTipsAPI = (keyword: string) => request({
   url: ENUM.searchTipsAPI,
   method: "GET",
   data: {
      keyword,
   },
});